<?php
/**
 * Created by PhpStorm.
 * User: 670
 * Date: 2021/12/9
 * Time: 11:39
 */
$userInfo = [
    ['admin','888888'],
    ['zhangsan','123456']
];
$temporaryName = '';
$temporaryPwd = '';

if(!empty($_POST['userName']) && !empty($_POST['pwd'])){
    for($i=0;$i<count($userInfo);$i++){
        $temporaryName = $userInfo[$i][0];
        $temporaryPwd = $userInfo[$i][1];
        if($temporaryName==$_POST['userName'] && $temporaryPwd==$_POST['pwd']){
            echo '登录成功<br />';
            $cookieName = md5($_POST['userName'].$_POST['pwd'].time());
            setcookie('Token',$cookieName,time()+24*3600);
            echo '<a href="userCenter.php">进入用户中心</a>';
            die();
        }
    }
    echo '用户名或密码不正确';
}else{
    echo '你的用户名或者密码为空';
}